package com.abc.controller;

import com.abc.entity.Chengji;
import com.abc.entity.User;
import com.abc.service.ChengjiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Controller
public class ChengjiController {
    @Autowired
    private ChengjiService chengjiService;
    @RequestMapping(value = "/findAllChengji")
    @ResponseBody
    public List<Map<String,Object>> findAllChengji(HttpServletRequest request){
        User user = (User)request.getSession().getAttribute("user");
        return chengjiService.findAllChengji(user.getId()+"");
    }@RequestMapping(value = "/findXsAllChengji")
    @ResponseBody
    public List<Map<String,Object>> findXsAllChengji(HttpServletRequest request){
        User user = (User)request.getSession().getAttribute("user");
        return chengjiService.findXsAllChengji(user.getId()+"");
    }


    @RequestMapping(value = "/addChengji")
    @ResponseBody
    public String addChengji(Chengji chengji){
        return chengjiService.addChengji(chengji);
    }
    @RequestMapping(value = "/gly")
    @ResponseBody
    public String gly(){
        return "11";
    }
    @RequestMapping(value = "/js")
    @ResponseBody
    public String js(){
        return "11";
    }
    @RequestMapping(value = "/xs")
    @ResponseBody
    public String xs(){
        System.out.println("学生执行了");
        return "11";
    }

}
